<template>
  <view class="message-detail">
    <uv-text :text="messageInfo.title" color="#212121" size="32rpx" />
    <uv-text
      :text="messageInfo.createTime"
      color="#BDBDBD"
      size="24rpx"
      lines="2"
      margin="20rpx 0"
    />
    <uv-parse
      :content="messageInfo.content"
      selectable
      lazy-load
      scroll-table
      container-style="color: #757575; font-size: 28rpx"
    />
  </view>
</template>
<script setup>
import { ref } from "vue";
import { onLoad } from "@dcloudio/uni-app";
import { getMsgDetail } from "@/request/message";

const messageId = ref(""); // 消息id
const messageInfo = ref({}); // 消息详情

onLoad((e) => {
  messageId.value = e.id;
  getDetail();
});

// 获取消息列表
const getDetail = () => {
  getMsgDetail(messageId.value).then((res) => {
    if (res.code == 200) {
      messageInfo.value = res.data;
      uni.$emit("message");
    }
  });
};
</script>
<style lang="scss" scoped>
.message-detail {
  padding: 30rpx 40rpx;
}
</style>
